<?php

require_once "core/application/classes/checkClass.php";
/**
 * @author PeoneEr
 * @package aion personal cabinet v1.0
 * @copyright Aion Factory Inc. 2010-2011
 * @license GNU v3
 * @link Ai-Factory.ru && http://code.google.com/p/aionprivateofficev2
 * @see core/application/classes/checkClass.php для просмотра инфы о проверках
 */
//Пользователи
if (isset($_GET['users']) && !isset($_GET['adm'])) {
    Check::getInstance();

    require "core/application/views/vusers.php";

    if (isset($_POST['search'])) {
        Check::getInstance();
        require_once "core/application/controllers/csearch.php";
        search_Controller::getInstance()->getSearch();
    }
}

//Запросы
if (isset($_GET['requests']) and !isset($_GET['act'])) {
    Check::getInstance();
    require "core/application/views/vrequests.php";
}
if (isset($_GET['act'])) {
    Check::getInstance();
    require "core/application/views/vrequests.php";


    if ($_GET['act'] == 'accept') {
        Check::getInstance();
        requests_Controller::getInstance()->setNewStatusRequest('accept');
    }
    if ($_GET['act'] == 'decine') {
        Check::getInstance();
        requests_Controller::getInstance()->setNewStatusRequest('decine');
    }
}



if (isset($_GET['login']))
    require_once "core/application/views/vlogon.php";

if (isset($_GET['legion'])) {
    Check::getInstance();
    require_once "core/application/views/vlegion.php";
}

if (isset($_POST['create'])) {
    Check::getInstance();
    require_once "core/application/views/vub.php";
}
if (isset($_POST['logOn'])) {
    require_once "core/application/controllers/clogon.php";
    auth_Controller::getInstance()->enterToAccount();
}
if (isset($_GET['error'])) {

    require_once "core/notifications/error.Notification.php";
    $error = new errorNotify();
    $error->showError();
}
if (isset($_GET['exit'])) {
    require_once "core/application/controllers/clogon.php";
    Check::getInstance();
    auth_Controller::getInstance()->exitFromAccount();
}
//Блок настроек
if (isset($_GET['settings']) && !isset($_GET['adm'])) {
    Check::getInstance();
    if (!isset($_GET['what'])) {
        Check::getInstance();
        require_once "core/application/views/vsettings.php";
    }
    //Блок защиты аккаунта
    if (isset($_GET['what']) && $_GET['what'] == 'ipForce') {
        Check::getInstance();
        require_once "core/application/views/viprestrict.php";
    }
    if (isset($_GET['what']) && $_GET['what'] == 'upload') {
        Check::getInstance();
        require_once "core/application/views/vupload.php";
    }
    //Установка и просмотр параметров
    if (isset($_GET['what']) && $_GET['what'] == 'setParams') {
        Check::getInstance();
        require_once "core/application/views/vsetparams.php";
        if (isset($_GET['sub']) && $_GET['sub'] == 'editParams') {
            Check::getInstance();
            require_once "core/application/views/veditparams.php";
        }
        if (isset($_GET['sub']) && $_GET['sub'] == 'secret') {
            Check::getInstance();
            require_once "core/application/controllers/csetsecret.php";
            secretWord_Controller::getInstance()->setNewSecretWord();
        }
        if (isset($_POST['changeLanguage'])) {
            Check::getInstance();
            require_once "core/application/controllers/cchangelanguage.php";
            Cchangelanguage::getInstance()->changeLanguage();
        }
    }
    if (isset($_GET['what']) && $_GET['what'] == 'change_password') {
        Check::getInstance();
        require_once "core/application/views/vchangepassword.php";
    }

    if (isset($_GET['what']) && $_GET['what'] == 'change_login') {
        Check::getInstance();
        require_once "core/application/views/vchangelogin.php";
    }


    if (isset($_GET['what']) && $_GET['what'] == 'userbar') {
        Check::getInstance();
        if (!isset($_POST['create'])) {
            require_once "core/application/views/vuserbars.php";
        }
    }
}
//Восстановление пароля

if (isset($_GET['submode']) && $_GET['submode'] == 'recoverypassword') {
	require_once "core/application/views/vrecovery.php";
}


//Регистрация
if (isset($_GET['submode']) && $_GET['submode'] == 'registration') {
    require_once "core/application/views/vreg.php";
    if (isset($_POST['send_reg'])) {
        require_once "core/application/controllers/cregistration.php";
        registration_Controller::getInstance()->register();
    }
}


//Услуги
if (isset($_GET['services'])) {
    Check::getInstance();
    /**
     * (non-phpdoc)
     * GET запросы
     */
    if (!isset($_GET['do'])) {
        Check::getInstance();
        require_once "core/application/views/vservices.php";
    }
    if (isset($_GET['do']) && $_GET['do'] == 'exchange') {
        Check::getInstance();
        require_once "core/application/views/vexchange.php";
    }
    if (isset($_GET['do']) && $_GET['do'] == 'open_stigma') {
        Check::getInstance();
        require_once "core/application/views/vstigma.php";
    }
    if (isset($_GET['do']) && $_GET['do'] == 'activate_premium') {
        Check::getInstance();
        require_once "core/application/views/vactivatepremium.php";
    }
    if (isset($_GET['do']) && $_GET['do'] == 'changegender') {
        Check::getInstance();
        require_once "core/application/views/vchangegender.php";
    }
    if (isset($_GET['do']) && $_GET['do'] == 'buy') {
        Check::getInstance();
        require_once "core/application/views/vgmshop.php";
    }
}
?>
